<template>
  <div class="MusicFooter flex justify-between iconfont">
    <!-- <mini-audio :audio-source="songSrc"></mini-audio> -->
    <div class="MusicFooter-left flex">
      <div class="MusicImage"><img :src="imgSrc" alt="" /></div>
      <div>
        <h4>{{ songName }}<small>&#xe604;</small></h4>
        <p>{{ author }}</p>
      </div>
    </div>
    <div class="MusicFooter-center">
      <div class="play-function flex">
        <div>&#xe607;</div>
        <div>&#xe63c;</div>
        <div class="play">&#xea82;</div>
        <div>&#xe63e;</div>
        <div class="text">词</div>
      </div>
      <div class="progress-bar">
        <vue-audio :audio-source="songSrc || songUrl" :loop="true"></vue-audio>
      </div>
    </div>
    <div class="MusicFooter-right flex">
      <div>标准</div>
      <div>&#xe616;</div>
      <div>&#xe810;</div>
      <div>&#xe6a2;</div>
      <div>&#xea83;</div>
    </div>
  </div>
</template>

<script>
import { getSongDetail, getSongUrl } from "./methods";
export default {
  name: "MusicFooter",
  data() {
    return {
      imgSrc: require("../../assets/YY.jpg"),
      songName: "左耳",
      author: "赵薇",
      songUrl: require("../../assets/赵薇 - 左耳.mp3"),
    };
  },
  computed: {
    songSrc() {
      return this.$store.state.songData.songUrl;
    },
  },
  created() {
    this.$bus.$on("item", (item) => {
      this.imgSrc = item.imageUrl;
      this.getSongDetail(item.targetId);
      this.getSongUrl(item.targetId);
    });
    this.$bus.$on("songId", (songId) => {
      this.getSongDetail(songId);
      this.getSongUrl(songId);
    });
  },

  methods: { getSongDetail, getSongUrl },
};
</script>

<style lang="scss" scoped>
@import "./_MusicFooter.scss";
</style>